package edu.neelsys.business.search;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import edu.neelsys.objectmodel.dbentites.Address;
import edu.neelsys.objectmodel.dbentites.CollegeSearchView;
import edu.neelsys.objectmodel.dbentites.Course;
import edu.neelsys.objectmodel.queryviews.CollegeSearchDTO;
import edu.neelsys.repository.college.CollegeRepository;
import edu.neelsys.repository.college.CollegeSearchViewRepository;
import edu.neelsys.repository.course.CourseRepository;

@Service
public class SearchService {

	@Autowired
	CollegeSearchViewRepository collegeSearch;

	@Autowired
	CourseRepository courseRepository;

	@Autowired
	CollegeRepository collegeRepository;

	public List<CollegeSearchView> getSearchData(String form) {
		try {

			List<CollegeSearchView> searchList = collegeSearch
					.findCollegeSearchView(form);

			return searchList;

		} catch (Exception e) {

		}
		return null;
	}

	public List<Course> getCourse() {

		try {
			List<Course> course = courseRepository.findAll();
			return course;

		} catch (Exception e) {
		}
		return null;
	}

	public List<CollegeSearchDTO> searchCollege(Address address,
			String courseName) {

		System.out.println("Inside Search College Methid====>");
		try {
			// College collegeDO = new College();

			List<CollegeSearchDTO> collegeList = collegeRepository.findCollege(
					address, courseName);

		} catch (Exception e) {

		}
		return null;
	}

}
